<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>试题管理</title>
    <!--图标-->
    <link rel="shortcut icon" href="../../static/favicon.ico" th:href="@{/static/favicon.ico}">
    <link href="../../static/css/bootstrap.min.css?v=3.3.6" th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet">
    <link href="../../static/css/font-awesome.css?v=4.4.0" th:href="@{/static/css/font-awesome.css}" rel="stylesheet">
    <link href="../../static/css/plugins/bootstrap-table/bootstrap-table.min.css"
          th:href="@{/static/css/plugins/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet">
    <link href="../../static/css/animate.css" th:href="@{/static/css/animate.css}" rel="stylesheet">
    <link href="../../static/css/style.css?v=4.1.0" th:href="@{/static/css/style.css}" rel="stylesheet">
    <!--滑动checkbox-->
    <link href="../../static/css/plugins/switchery/switchery.css"
          th:href="@{/static/css/plugins/switchery/switchery.css}"
          rel="stylesheet">
    <!-- Sweet Alert -->
    <link href="../../static/css/plugins/sweetalert/sweetalert.css"
          th:href="@{/static/css//plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="../../static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
          th:href="@{/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
          rel="stylesheet">
    <!--代码编辑框-->
    <link href="../../static/css/plugins/codemirror/codemirror.css"
          th:href="@{/static/css/plugins/codemirror/codemirror.css" rel="stylesheet">
    <link href="../../static/css/plugins/codemirror/ambiance.css" th:href="/static/css/plugins/codemirror/ambiance.css"
          rel="stylesheet">
    <!--simditor-->
    <link rel="stylesheet" type="text/css" href="../../static/css/plugins/simditor/simditor.css"
          th:href="@{/static/css/plugins/simditor/simditor.css"/>
    <!--自定义样式-->
    <link rel="stylesheet" type="text/css" href="../../static/public/exam/css/exam.css"
          th:href="@{/static/public/exam/css/exam.css"/>

</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox-title">
        <div class="row row-lg">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="message">我的试题</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false"
                                        id="class_resource">共享试题</a></li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body" style="padding-bottom: 0">
                                <p style="color: #aaa" id="regulate">题库用于对试题进行分类管理，请在以下列表中管理您的题库</p>
                                <p style="color: #aaa" id="create" class="hidden">填写下面的表单，创建一个新的题库</p>
                                <p style="color: #aaa" id="update" class="hidden">在下面的表单中修改题库信息</p>
                                <p style="color: #aaa" id="import_test" class="hidden">在下列表单中批量导入试题</p>
                                <div class="btn-group" style="margin-bottom: 15px">
                                    <a class="btn btn-sm btn-white create_question">创建试题</a>
                                    <a class="btn btn-sm  btn-success test_base_management"
                                       style="margin-left: 3px;">试题管理</a>
                                    <a class="btn btn-sm btn-white import_test_questions"
                                       style="margin-left: 20px">导入试题</a>
                                </div>
                                <!--试题管理-->
                                <form class="form-inline" style="margin-bottom:15px" id="create_question"
                                      style="display:none;">
                                    <div style="margin-bottom: 20px">
                                        <div class="form-group">
                                            <div class="input-group">
                                                <input class="form-control" type="text" placeholder="关键字"
                                                       maxlength="30">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <select class="form-control">
                                                    <option value="">所属题库</option>
                                                    <option>编程题库(共12题)</option>
                                                    <option>解答题库(共10题)</option>
                                                    <option>选择题库(共5题)</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <select class="form-control">
                                                    <option value="">请选择题型</option>
                                                    <option>单选题</option>
                                                    <option>多选题</option>
                                                    <option>判断题</option>
                                                    <option>填空题</option>
                                                    <option>问答题</option>
                                                    <option>附件题</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <input class="form-control" type="text" placeholder="标签">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <select class="form-control">
                                                    <option value="">难度</option>
                                                    <option>极易</option>
                                                    <option>容易</option>
                                                    <option>一般</option>
                                                    <option>较难</option>
                                                    <option>极难</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <select class="form-control">
                                                    <option value="">状态</option>
                                                    <option>正常</option>
                                                    <option>禁用</option>
                                                </select>
                                            </div>
                                        </div>
                                        <button type="button" class="btn btn-success fa fa-search"
                                                value="查询" style="height: 34px"
                                                id="queryBtn">
                                        </button>
                                    </div>
                                    <!-- 我的题库 -->
                                    <table id="my_test_item_table"></table>
                                </form>
                                <!--创建试题-->
                                <div id="test_base_management" style="display:none;">
                                    <div class="tm-tab-body" style="padding-left: 0;">
                                        <h1 class="tm-table-form-base-title">创建试题</h1>
                                        <div class="tm_table_form_base_body">
                                            <form method="get" class="form-horizontal">
                                                <div class="append_panel">
                                                    <div class="form-group">
                                                        <label class="col-sm-offset-1 col-sm-1 control-label">试题类型</label>
                                                        <div class="col-sm-3">
                                                            <select class="form-control add_select_box">
                                                                <option selected>单选题</option>
                                                                <option>多选题</option>
                                                                <option>判断题</option>
                                                                <option>填空题</option>
                                                                <option>问答题</option>
                                                                <option>附件题</option>
                                                            </select>
                                                        </div>
                                                        <label class="col-sm-1 control-label">试题难度</label>
                                                        <div class="col-sm-3">
                                                            <select class="form-control">
                                                                <option value="">请选择对应的难度</option>
                                                                <option>极易</option>
                                                                <option>容易</option>
                                                                <option>一般</option>
                                                                <option>较难</option>
                                                                <option>极难</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-offset-1 col-sm-1 control-label">所属题库</label>
                                                        <!-- <label class="col-sm-1 control-label col-sm-offset-1">所属题库</label>-->
                                                        <div class="col-sm-3">
                                                            <div class="input-group">
                                                                <select class="form-control"
                                                                        style="-webkit-appearance: none">
                                                                    <option value="">所属题库</option>
                                                                    <option>编程题库(共12题)</option>
                                                                    <option>解答题库(共10题)</option>
                                                                    <option>选择题库(共5题)</option>
                                                                </select>
                                                                <span class="input-group-btn">
                                                                    <button class="btn btn-success" type="button"
                                                                            style="height:34px" data-toggle="modal"
                                                                            data-target=".bs-example-modal-sm">
                                                                    <i class="fa fa-plus"></i></button>
                                                                </span>
                                                            </div>
                                                        </div>
                                                        <label class="col-sm-1 control-label">试题来源</label>
                                                        <div class="col-sm-3">
                                                            <input class="form-control" value="原创">
                                                        </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">
                                                            试题标签</label>
                                                        <div class="col-sm-7">
                                                            <div class="tags" id="tags" tabindex="1">
                                                                <input id="form-field-tags" type="text"
                                                                       placeholder="请输入标签 ..." value="Tag Input Control"
                                                                       name="tags" style="display: none;">
                                                                <input type="text" placeholder="请输入标签 ..."
                                                                       class="tags_enter" autocomplete="off"
                                                                       onkeyup="this.value=this.value.replace(/[, ]/g,'')">
                                                                <!--输入框去除空格-->
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">题库状态</label>
                                                        <div class="col-sm-7">
                                                            <label class="control-label">
                                                                <div class="radio radio-success radio-inline">
                                                                    <input type="radio" id="inlineRadio1"
                                                                           value="option1" name="radioInline"
                                                                           checked>
                                                                    <label for="inlineRadio1">正常</label>
                                                                </div>
                                                            </label>&nbsp;
                                                            <label class="control-label">
                                                                <div class="radio radio-danger radio-inline">
                                                                    <input type="radio" id="inlineRadio2"
                                                                           value="option2" name="radioInline">
                                                                    <label for="inlineRadio2">禁用</label>
                                                                </div>
                                                            </label>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">
                                                            试题题干</label>
                                                        <div class="col-sm-7 ">
                                                            <textarea id="editor" autofocus></textarea>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label answer_choice">
                                                            选项设置</label>
                                                        <div class="col-sm-7">
                                                            <!--单选题-->
                                                            <div style="margin: 0 0 10px 0" class="multiple_choice">
                                                                <button class="btn btn-success" id="add_section_btn"
                                                                        type="button">
                                                                    <i class="fa fa-plus"></i>增加选项
                                                                </button>
                                                                <span class="text-muted">
                                                                    点击按钮增加新的选项，并选择其中1个做为答案</span>
                                                                <div class="checkbox checkbox-info checkbox-inline"
                                                                     style="display:none;">
                                                                    <input id="checkbox8" type="checkbox" checked="">
                                                                    <label for="checkbox8">
                                                                        混杂模式 <span>批改时忽略考生答案的顺序给分</span>
                                                                    </label>
                                                                </div>
                                                            </div>
                                                            <!--单选题-->
                                                            <div class="judgment" style="display: none">
                                                                <div class="radio radio-success">
                                                                    <input type="radio" name="judgment" id="true"
                                                                           checked="">
                                                                    <label for="true">
                                                                        正确
                                                                    </label>
                                                                </div>
                                                                <div class="radio radio-danger">
                                                                    <input type="radio" name="judgment" id="false">
                                                                    <label for="false">
                                                                        错误
                                                                    </label>
                                                                </div>
                                                            </div>
                                                            <!--附件题-->
                                                            <div class="attachment_title" style="display: none">
                                                                <div id="file-pretty">
                                                                    <input type="file" multiple="multiple"
                                                                           class="form-control hidden"
                                                                           name="attachmentShows">
                                                                </div>
                                                                <label>请上传*.txt;*.doc;*.pdf;*.docx;*.zip;*.rar格式的试题参考答案附件，10M以内。</label>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div class="panel-group col-sm-offset-2 accordion"
                                                                 id="accordion"
                                                                 role="tablist" aria-multiselectable="true">
                                                                <!-- 答案选项 单选题-->
                                                                <div class="col-sm-5">
                                                                    <!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->
                                                                    <div class="panel panel-default">
                                                                        <!-- 一组章节 -->
                                                                        <div class="panel-heading " role="tab">
                                                                            <h4 class="panel-title">
                                                                                <!-- 在右上角添加关闭小图标 -->
                                                                                <button type="button"
                                                                                        class="close addClose"
                                                                                        data-dismiss="close"
                                                                                        style="margin-top: 3px;">
                                                                                    <span class="scaleClose"
                                                                                          style="size: 30px">&times;</span>
                                                                                </button>
                                                                                <!-- 输入项: 章节名称 -->
                                                                                <div class="radio radio-success"
                                                                                     style="width:85%">
                                                                                    <input type="radio"
                                                                                           class="radio_select"
                                                                                           id="chapter_options"
                                                                                           name="chapter_options"
                                                                                           checked>
                                                                                    <label class="options"
                                                                                           for="chapter_options">选项A</label>
                                                                                </div>
                                                                            </h4>
                                                                        </div>
                                                                        <!-- 内容区 -->
                                                                        <div class="panel-body">
                                                                            <textarea id="editor1" autofocus></textarea>
                                                                        </div>
                                                                    </div><!-- end of panel -->
                                                                </div> <!-- end of col-sm-5 -->
                                                                <!-- 多选题 -->
                                                                <div class="col-sm-5" style="display:none;">
                                                                    <!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->
                                                                    <div class="panel panel-default">
                                                                        <!-- 一组章节 -->
                                                                        <div class="panel-heading " role="tab">
                                                                            <h4 class="panel-title">
                                                                                <!-- 在右上角添加关闭小图标 -->
                                                                                <button type="button" class="close"
                                                                                        data-dismiss="close"
                                                                                        style="margin-top: 3px;">
                                                                                    <span class="scaleClose"
                                                                                          style="size: 30px">&times;</span>
                                                                                </button>
                                                                                <!-- 输入项: 章节名称 -->
                                                                                <div class="checkbox"
                                                                                     style="width: 85%">
                                                                                    <input type="checkbox"
                                                                                           class="choice"
                                                                                           id="selects"
                                                                                           value="option1">
                                                                                    <label class="selects"
                                                                                           for="selects">
                                                                                        选项A </label>
                                                                                </div>
                                                                            </h4>
                                                                        </div>
                                                                        <!-- 内容区 -->
                                                                        <div class="panel-body">
                                                                            <textarea id="editor2" autofocus></textarea>
                                                                        </div>
                                                                    </div><!-- end of panel -->
                                                                </div> <!-- end of col-sm-5 -->
                                                                <!--问答题-->
                                                                <div class="col-sm-5" style="display: none">
                                                                    <textarea id="qa_editor" autofocus></textarea>

                                                                </div> <!-- end of col-sm-5 -->
                                                                <!--填空题-->
                                                                <div class="col-sm-5" style="display: none">
                                                                    <!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->
                                                                    <div class="alert alert-dismissable fade in"
                                                                         style="background-color: #d2cece ">
                                                                        <button class="close" type="button"
                                                                                data-dismiss="alert" aria-label="Close">
                                                                            <span aria-hidden="true"
                                                                                  style="color: white">x</span>
                                                                        </button>
                                                                        <h3 style="color: white">填空1</h3>
                                                                        <input type="text" class="form-control"
                                                                               placeholder="请填写答案">
                                                                    </div>
                                                                </div> <!-- end of col-sm-5 -->
                                                            </div>  <!-- end of panel-group -->
                                                            <!--多选题-->
                                                        </div>
                                                        <!-- 答案解析 -->
                                                        <div class="form-group">
                                                            <label class="col-sm-2 control-label">答案解析</label>
                                                            <div class="col-sm-7">
                                                                <textarea id="answer_editor" autofocus></textarea>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <div class="col-md-offset-2 col-sm-10">
                                                            <button type="button" class="btn btn-success">提交
                                                            </button>
                                                            <button type="reset" class="btn btn-white">重新填写
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                <!--导入试题-->
                                <div id="import_test_questions" style="display:none;">
                                    <div class="tm-tab-body" style="padding-left: 0;">
                                        <h1 class="tm-table-form-base-title">批量导入试题</h1>
                                        <div class="modal-body" style="margin: 10px 20px 0 20px ">
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div class="col-sm-11">
                                                        <h4 style="font-size: 14px;font-weight: bold;margin: 15px 0 10px 0">
                                                            操作说明</h4>
                                                        <div style="margin: 0 0 20px 0">
                                                            <p class="twm_desc">1、下载
                                                                <a href="#" target="_blank">
                                                                    <u>EXcel格式模板</u>
                                                                </a>
                                                                文件。
                                                            </p>
                                                            <p class="twm_desc">2、请注意格式要求，一个题型一个文件，多余的单元格可留空。</p>
                                                            <p class="twm_desc">
                                                                3、请确保EXCEL文件版本为2007~2010，并请勿删除（或新增）模板文件中的列，确保文件能顺利解析。</p>
                                                            <p class="twm_desc">4、请核对填写日期单元格，其属性为“文本”。</p>
                                                            <p class="twm_desc">5、默认全局自动去重后导入，如有需要，可在表单中设置忽略重复。</p>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-11">
                                                        <h1 class="tm_table_form_base_title">批量导入</h1>
                                                        <div class="tm_table_form_base_body">
                                                            <form method="post">
                                                                <table class="tm_table_form_base" style="width: 90%">
                                                                    <tbody>
                                                                    <tr>
                                                                        <th width="120"
                                                                            style="padding-left: 40px;">
                                                                            目标题库
                                                                        </th>
                                                                        <td>
                                                                            <select class="form-control validate[required]"
                                                                                    style="margin-bottom: 10px">
                                                                                <option value="">请选择目标题库</option>
                                                                                <option>开发题</option>
                                                                                <option>编程题</option>
                                                                                <option>选择题</option>
                                                                            </select>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th style="padding-left: 40px;">数据文件</th>
                                                                        <td>
                                                                            <input class="form-control"
                                                                                   style="margin-bottom: 10px"
                                                                                   type="file">
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <th style="padding-left: 40px;">重复数据</th>
                                                                        <td>
                                                                            <select class="form-control validate[required]">
                                                                                <option value="">自动去除重复试题</option>
                                                                                <option>忽略重复试题，全部导入</option>
                                                                            </select>
                                                                        </td>
                                                                    </tr>
                                                                    </tbody>
                                                                    <tfoot>
                                                                    <tr>
                                                                        <th></th>
                                                                        <td>
                                                                            <div style="margin-top: 20px">
                                                                                <button type="button"
                                                                                        class="btn btn-success">批量导入
                                                                                </button>
                                                                                <button type="reset"
                                                                                        class="btn btn-white">重置
                                                                                </button>
                                                                            </div>
                                                                        </td>
                                                                    </tr>
                                                                    </tfoot>
                                                                </table>
                                                            </form>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--修改-->
                                <div id="modify" style="display:none;">
                                    <div class="tm-tab-body" style="padding-left: 0;">
                                        <h1 class="tm-table-form-base-title">修改试题</h1>
                                        <div class="tm_table_form_base_body">
                                            <form method="post" class="form-horizontal">
                                                <div class="append_panel">
                                                    <div class="form-group">
                                                        <label class="col-sm-offset-1 col-sm-1 control-label">试题类型</label>
                                                        <div class="col-sm-3">
                                                            <select class="form-control question_type" disabled>
                                                                <option>单选题</option>
                                                                <option>多选题</option>
                                                                <option>判断题</option>
                                                                <option>填空题</option>
                                                                <option>问答题</option>
                                                                <option>附件题</option>
                                                            </select>
                                                        </div>
                                                        <label class="col-sm-1 control-label">试题难度</label>
                                                        <div class="col-sm-3">
                                                            <select class="form-control modify_difficulty">
                                                                <option value="">请选择对应的难度</option>
                                                                <option>极易</option>
                                                                <option>容易</option>
                                                                <option>一般</option>
                                                                <option>较难</option>
                                                                <option>极难</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-offset-1 col-sm-1 control-label">所属题库</label>
                                                        <!-- <label class="col-sm-1 control-label col-sm-offset-1">所属题库</label>-->
                                                        <div class="col-sm-3">
                                                            <div class="input-group">
                                                                <select class="form-control modify_test_bank"
                                                                        style="-webkit-appearance: none">
                                                                    <option value="">所属题库</option>
                                                                    <option>编程题库(共12题)</option>
                                                                    <option>解答题库(共10题)</option>
                                                                    <option>选择题库(共5题)</option>
                                                                </select>
                                                                <span class="input-group-btn">
                                                                    <button class="btn btn-success" type="button"
                                                                            style="height:34px" data-toggle="modal"
                                                                            data-target="#modify_modal">
                                                                    <i class="fa fa-plus"></i></button>
                                                                </span>
                                                            </div>
                                                        </div>
                                                        <label class="col-sm-1 control-label">试题来源</label>
                                                        <div class="col-sm-3">
                                                            <input class="form-control modify_input" value="原创">
                                                        </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">
                                                            试题标签</label>
                                                        <div class="col-sm-7">
                                                            <div class="modify_tags" id="modify_tags" tabindex="1">
                                                                <input id="modify_form-field-tags" type="text"
                                                                       placeholder="请输入标签 ..." value="Tag Input Control"
                                                                       name="tags" style="display: none;">
                                                                <input type="text" placeholder="请输入标签 ..."
                                                                       class="modify_tags_enter" autocomplete="off"
                                                                       onkeyup="this.value=this.value.replace(/[, ]/g,'')">
                                                                <!--输入框去除空格-->
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">题库状态</label>
                                                        <div class="col-sm-7">
                                                            <label class="control-label">
                                                                <div class="radio radio-success radio-inline">
                                                                    <input type="radio" id="modify_radio1"
                                                                           value="option1" name="radioInline">
                                                                    <label for="modify_radio1">正常</label>
                                                                </div>
                                                            </label>&nbsp;
                                                            <label class="control-label">
                                                                <div class="radio radio-danger radio-inline">
                                                                    <input type="radio" id="modify_radio2"
                                                                           value="option2" name="radioInline">
                                                                    <label for="modify_radio2">禁用</label>
                                                                </div>
                                                            </label>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">
                                                            试题题干</label>
                                                        <div class="col-sm-7 topic">
                                                            <textarea id="modify_editor" autofocus></textarea>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label answer_choice">
                                                            选项设置</label>
                                                        <div class="col-sm-7">
                                                            <!--单选题-->
                                                            <div style="margin: 0 0 10px 0" class="multiple_choice">
                                                                <button class="btn btn-success"
                                                                        id="modify_add_section_btn"
                                                                        type="button">
                                                                    <i class="fa fa-plus"></i>增加选项
                                                                </button>
                                                                <span class="text-muted">
                                                                    点击按钮增加新的选项，并选择其中1个做为答案</span>
                                                                <div class="checkbox checkbox-info checkbox-inline"
                                                                     style="display:none;">
                                                                    <input id="full_blank" type="checkbox" checked="">
                                                                    <label for="full_blank">
                                                                        混杂模式 <span>批改时忽略考生答案的顺序给分</span>
                                                                    </label>
                                                                </div>
                                                            </div>
                                                            <!--单选题-->
                                                            <div class="judgment" style="display: none">
                                                                <div class="radio radio-success">
                                                                    <input type="radio" name="judgment" id="modify_true"
                                                                           checked="">
                                                                    <label for="modify_true">
                                                                        正确
                                                                    </label>
                                                                </div>
                                                                <div class="radio radio-danger">
                                                                    <input type="radio" name="judgment"
                                                                           id="modify_false">
                                                                    <label for="modify_false">
                                                                        错误
                                                                    </label>
                                                                </div>
                                                            </div>
                                                            <!--附件题-->
                                                            <div class="modify_attachment_title" style="display: none">
                                                                <div id="modify_file-pretty">
                                                                    <input type="file" multiple="multiple"
                                                                           class="form-control"
                                                                           name="attachmentShows">
                                                                </div>
                                                                <label>请上传*.txt;*.doc;*.pdf;*.docx;*.zip;*.rar格式的试题参考答案附件，10M以内。</label>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div class="panel-group col-sm-offset-2"
                                                                 id="modify_accordion"
                                                                 role="tablist" aria-multiselectable="true">
                                                                <!-- 多选题 -->
                                                                <div class="col-sm-5" style="display:none;">
                                                                    <!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->
                                                                    <div class="panel panel-default">
                                                                        <!-- 一组章节 -->
                                                                        <div class="panel-heading" role="tab">
                                                                            <h4 class="panel-title">
                                                                                <!-- 在右上角添加关闭小图标 -->
                                                                                <button type="button" class="close"
                                                                                        data-dismiss="close"
                                                                                        style="margin-top: 3px;">
                                                                                    <span class="scaleClose"
                                                                                          style="size: 30px">&times;</span>
                                                                                </button>
                                                                                <!-- 输入项: 章节名称 -->
                                                                                <div class="checkbox"
                                                                                     style="width: 85%">
                                                                                    <input type="checkbox"
                                                                                           class="choice"
                                                                                           id="modify_selects"
                                                                                           value="option1">
                                                                                    <label class="selects"
                                                                                           for="selects">
                                                                                        选项A </label>
                                                                                </div>
                                                                            </h4>
                                                                        </div>
                                                                        <!-- 内容区 -->
                                                                        <div class="panel-body">
                                                                            <textarea id="modify_editor2"
                                                                                      autofocus></textarea>
                                                                        </div>
                                                                    </div><!-- end of panel -->
                                                                </div> <!-- end of col-sm-5 -->
                                                                <!--问答题-->
                                                                <div class="col-sm-5 modify_qa_editor"
                                                                     style="display: none">
                                                                    <textarea id="modify_qa_editor"
                                                                              autofocus></textarea>
                                                                </div> <!-- end of col-sm-5 -->
                                                                <!--填空题-->
                                                                <div class="col-sm-5" style="display: none">
                                                                    <!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->
                                                                    <div class="alert alert-dismissable fade in"
                                                                         style="background-color: #d2cece ">
                                                                        <button class="close" type="button"
                                                                                data-dismiss="alert" aria-label="Close">
                                                                            <span aria-hidden="true"
                                                                                  style="color: white">x</span>
                                                                        </button>
                                                                        <h3 style="color: white">填空1</h3>
                                                                        <input type="text" class="form-control"
                                                                               placeholder="请填写答案">
                                                                    </div>
                                                                </div> <!-- end of col-sm-5 -->
                                                            </div>  <!-- end of panel-group -->
                                                            <!--多选题-->
                                                        </div>
                                                        <!-- 答案解析 -->
                                                        <div class="form-group">
                                                            <label class="col-sm-2 control-label">答案解析</label>
                                                            <div class="col-sm-7 answer_parsing">
                                                                <textarea id="modify_answer_editor"
                                                                          autofocus></textarea>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <div class="col-md-offset-2 col-sm-10">
                                                            <button type="button" class="btn btn-success">提交
                                                            </button>
                                                            <button type="reset" class="btn btn-white">重新填写
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--共享题库-->
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body" style="padding-bottom: 0">
                                <div id="share_question_bank_tips">
                                    <p style="color: #aaa">共享试题是由各管理员创建并通过<strong>&nbsp;题库共享 &nbsp;</strong>，提供给所有管理员使用的试题
                                        ，您可以使用这些试题创建试卷、组织考试</p>
                                </div>
                                <p id="modify_the_prompt" class="hidden" style="color: red">注意：您正在修改其他管理员创建的题库，请谨慎操作</p>
                                <form class="form-inline" id="question_bank" style="margin-bottom:15px; ">
                                    <div style="margin-bottom: 20px">
                                        <div class="form-group">
                                            <div class="input-group">
                                                <input class="form-control" type="text" placeholder="关键字"
                                                       maxlength="30">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <select class="form-control">
                                                    <option value="">状态</option>
                                                    <option value="1">正常</option>
                                                    <option value="2">禁用</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="input-group">
                                                <input class="form-control" type="text" placeholder="创建人">
                                            </div>
                                        </div>
                                        <button type="button" class="btn btn-success fa fa-search"
                                                value="查询" style="height: 34px">
                                        </button>
                                    </div>
                                    <!-- 共享题库 -->
                                    <table id="share_test_item_table"></table>
                                </form>
                            </div>
                        </div>
                    </div> <!--  end of 共享题库 -->
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<!--试题预览-->
<div class="modal fade" id="review_test_item" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">试题预览</h3>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-sm-12">
                            <div style="margin: 15px 0"></div>
                            <table class="tm_table_form" id="preview_table" width="100%" cellpadding="5"
                                   border="0">
                                <tbody>
                                <tr>
                                    <th style="width: 100px"><b>试题类型</b></th>
                                    <td></td>
                                </tr>
                                <tr>
                                    <th>
                                        <b>试题难度</b>
                                    </th>
                                    <td></td>
                                </tr>
                                <tr>
                                    <th>
                                        <b>所属题库</b>
                                    </th>
                                    <td></td>
                                </tr>
                                <tr>
                                    <th>
                                        <b>试题标签</b>
                                    </th>
                                    <td><span class="label label label-success"></span></td>
                                </tr>
                                <tr>
                                    <th>
                                        <b>试题状态</b>
                                    </th>
                                    <td></td>
                                </tr>
                                <tr>
                                    <th>
                                        <b>试题题干</b>
                                    </th>
                                    <td style="word-break: break-all">
                                        <p style="background: rgb(238,238,238);padding: 5px 10px;border:1px solid rgb(204,204,204);border-image: none;margin-bottom: 0"></p>
                                    </td>
                                </tr>
                                <tr class="settings" style="display: none">
                                    <th>
                                        <b>选项设置</b>
                                    </th>
                                    <td>
                                        <table class="option_settings" width="100%" cellpadding="5" border="0">
                                            <tbody class="tbody">
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                                <tr class="QA">
                                    <th>
                                        <b>试题答案</b>
                                    </th>
                                    <td class="code" style="word-break: break-all">
                                        <input id="code"/>
                                    </td>
                                    <td class="test_answer" style="display: none">
                                        测试
                                    </td>
                                </tr>
                                <!--填空题试题答案-->
                                <tr class="FB_QA" style="display: none">
                                    <th>
                                        <b>试题答案</b>
                                    </th>
                                    <td>
                                        <table class="QA_table" width="100%" cellpadding="5" border="0">
                                            <tbody class="tbody">
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        <b>答案解析</b>
                                    </th>
                                    <td class="Parsing">
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div> <!-- end of review_test_item -->
<!--共享试题预览-->
<!--添加题库模态框-->
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">请输入新题库的名称</h3>
            </div>
            <div class="modal-body">
                <form>
                    <input class="form-control">
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success">添加</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--修改里的添加题库-->
<div class="modal fade bs-example-modal-sm" id="modify_modal" tabindex="-1" role="dialog"
     aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">请输入新题库的名称</h3>
            </div>
            <div class="modal-body">
                <form>
                    <input class="form-control">
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success">添加</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
</body>
<!-- 全局js -->
<script src="../../static/js/jquery.min.js?v=2.1.4"
        th:href="@{/static/js/jquery.min.js}"></script>
<script src="../../static/js/bootstrap.min.js?v=3.3.6"
        th:href="@{/static/js/bootstrap.min.js}"></script>
<!-- 自定义js -->
<script src="../../static/js/content.js?v=1.0.0"
        th:href="@{/static/js/content.js}"></script>
<!-- Bootstrap table -->
<script src="../../static/js/plugins/bootstrap-table/bootstrap-table.min.js"
        th:href="@{/static/js/plugins/bootstrap-table/bootstrap-table.min.js}"></script>
<script src="../../static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"
        th:href="@{/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js}"></script>
<script src="../../static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
        th:href="@{/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<!--动态搜索-->
<script src="../../static/js/plugins/suggest/bootstrap-suggest.min.js"
        th:href="@{/static/js/plugins/suggest/bootstrap-suggest.min.js}"></script>
<!-- layerDate plugin javascript -->
<script src="../../static/js/plugins/layer/laydate/laydate.js"
        th:href="@{/static/js/plugins/layer/laydate/laydate.js}"></script>
<!-- Sweet alert -->
<script src="../../static/js/plugins/sweetalert/sweetalert.min.js"
        th:href="@{/static/js/plugins/sweetalert/sweetalert.min.js}"></script>
<!--滑动按钮-->
<script src="../../static/js/plugins/switchery/switchery.js"
        th:src="@{/static/js/plugins/switchery/switchery.js}"></script>
<!-- Peity -->
<script src="../../static/js/plugins/peity/jquery.peity.min.js"
        th:src="@{/static/js/plugins/peity/jquery.peity.min.js}"></script>
<!-- CodeMirror -->
<script src="../../static/js/plugins/codemirror/codemirror.js"
        th:src="@{/static/js/plugins/codemirror/codemirror.js}"></script>
<script src="../../static/js/plugins/codemirror/mode/javascript/javascript.js"
        th:src="@{/static/js/plugins/codemirror/mode/javascript/javascript.js}"></script>
<!-- simditor -->
<script type="text/javascript" src="../../static/js/plugins/simditor/module.js"
        th:href="@{/static/js/plugins/simditor/module.js}"></script>
<script type="text/javascript" src="../../static/js/plugins/simditor/uploader.js"
        th:href="@{/static/js/plugins/simditor/uploader.js}"></script>
<script type="text/javascript" src="../../static/js/plugins/simditor/hotkeys.js"
        th:href="@{/static/js/plugins/simditor/hotkeys.js}"></script>
<script type="text/javascript" src="../../static/js/plugins/simditor/simditor.js"
        th:href="@{/static/js/plugins/simditor/simditor.js}"></script>
<!-- Prettyfile -->
<script src="../../static/js/plugins/prettyfile/bootstrap-prettyfile.js"
        th:href="@{/static/js/plugins/prettyfile/bootstrap-prettyfile.js}"></script>
<!--自定义js-->
<script src="../../static/public/exam/js/testlermList.js"
        th:href="@{/static/public/exam/js/testlermList.js}"></script>
<script src="../../static/public/exam/js/modifyOptions.js"
        th:href="@{/static/public/exam/js/modifyOptions.js}"></script>
<script>
    /*文件上传*/
    $('#file-pretty input[type="file"]').prettyFile();
    $('#modify_file-pretty input[type="file"]').prettyFile();
    /*隐藏文件上传输入框*/
    //$('.input-large').css("display", "none");
    //$('#file-pretty').children(0).css("width", "82px");
    $(function () {

        /*创建试题*/
        $('.create_question').click(function () {
            $('.create_question').attr("class", "btn btn-sm btn-success create_question");
            $('#create_question').css("display", "none");
            $('#import_test_questions').css("display", "none");
            $('.test_base_management').attr("class", "btn btn-sm btn-white test_base_management");
            $('.import_test_questions').attr("class", "btn btn-sm btn-white import_test_questions");
            $('#test_base_management').css("display", "");
            $('#accordion').css("display", "");
            $('.multiple_choice').css("display", "");
            $('#accordion .col-sm-5').eq(3).nextAll().remove();
            /*选中小的编辑框添加唯一属性*/
            $('#collapseOne').find('div:eq(3)').attr("class", "simditor-toolbar changed");
            /*找到同级其他兄弟元素*/
            $('#collapseOne').find('div:eq(3)').siblings().attr("class", "simditor-body changed");
            /*判断子元素下面的元素个数是否大于两个,是则删除多余元素*/
            if ($('#collapseOne').find('div:eq(2)').children().length > 2) {
                $('#collapseOne').find('div:eq(3)').next().remove();
            }

            $('#regulate').attr("class", "hidden");
            $('#modification').css("display", "none");
            $('#create').attr("class", "");
            $('#update').attr("class", "hidden");
            $('#import_test').attr("class", "hidden");
            $('#modify').css("display", "none");
        }); //end of xxxx

        /*题库管理*/
        $('.test_base_management').click(function () {
            $('.test_base_management').attr("class", "btn btn-sm btn-success test_base_management");
            $('#test_base_management').css("display", "none");
            $('#import_test_questions').css("display", "none");
            $('.create_question').attr("class", "btn btn-sm btn-white create_question");
            $('.import_test_questions').attr("class", "btn btn-sm btn-white import_test_questions");
            $('#create_question').css("display", "");
            $('#modification').css("display", "none");
            $('#regulate').attr("class", "");
            $('#create').attr("class", "hidden");
            $('#update').attr("class", "hidden");
            $('#import_test').attr("class", "hidden");
            $('#accordion .col-sm-5').eq(3).nextAll().remove();
            /*选中小的编辑框添加唯一属性*/
            $('#collapseOne').find('div:eq(3)').attr("class", "simditor-toolbar");
            /*找到同级其他兄弟元素*/
            $('#collapseOne').find('div:eq(3)').siblings().attr("class", "simditor-body");
            $('#modify').css("display", "none");
        });

    });

    /*导入试题*/
    $('.import_test_questions').click(function () {
        //点击按钮改变颜色其他的变为白色
        $('.import_test_questions').attr("class", "btn btn-sm btn-success import_test_questions");
        $('.create_question').attr("class", "btn btn-sm btn-white create_question");
        $('.test_base_management').attr("class", "btn btn-sm btn-white test_base_management");
        //隐藏其他表单
        $('#create_question').css("display", "none");
        $('#modification').css("display", "none");
        $('#test_base_management').css("display", "none");
        $('#update').attr("class", "hidden");
        $('#create').attr("class", "hidden");
        $('#regulate').attr("class", "hidden");
        $('#import_test').attr("class", "");
        $('#import_test_questions').css("display", "");
        /*选中小的编辑框添加唯一属性*/
        $('#collapseOne').find('div:eq(3)').attr("class", "simditor-toolbar");
        /*找到同级其他兄弟元素*/
        $('#collapseOne').find('div:eq(3)').siblings().attr("class", "simditor-body");
        $('#modify').css("display", "none");
    });
</script>
<!--下拉选择框的值改变页面-->
<script>
    $('.add_select_box').find("option:contains('单选框')").attr("selected", true);
    testItemList(0);
    /*重复调用*/
    $('.col-sm-3 select').change(function () {
        /*选择判断题时,答案选项显示单选框 修改label的值*/
        $(this).on('click', function (event) {
            /*判断下拉选择项*/
            event.stopImmediatePropagation();
            if (this.value === '判断题') {
                $('.answer_choice').text("答案设置");
                /*隐藏添加按钮*/
                $('.multiple_choice').css('display', 'none');
                /*隐藏单选框*/
                let $container = $(".panel-group");
                // $(".col-sm-5", $container).eq(0).css("display", "none");
                $(".col-sm-5", $container).eq(0).siblings().css("display", "none");
                $(".col-sm-5", $container).eq(0).css("display", "none");
                /*把选择框显现*/
                $('.judgment').css('display', '');
                /*隐藏文件上传*/
                $('.attachment_title').css('display', 'none');
            }
            /**/
            if (this.value === '单选题') {
                /*显示编辑框*/
                $('#accordion').css('display', '');
                /*提示文字*/
                $('.text-muted').css('display', '').text('点击按钮增加新的选项，并选择其中1个做为答案');
                /*混杂模式*/
                $('.checkbox-inline').css('display', 'none');
                $('.answer_choice').text("选项设置");
                /*显示添加按钮*/
                $('.multiple_choice').css('display', '');

                /*把选择框显现*/
                $('.judgment').css('display', 'none');
                /*显示单选框*/
                let $container = $(".panel-group");
                /*单选框*/
                $(".col-sm-5", $container).eq(0).removeAttr("style");
                $(".col-sm-5", $container).eq(0).nextAll().css("display", "none");
                /*隐藏文件上传*/
                $('.attachment_title').css('display', 'none');
                //testItemList(0);
            }
            if (this.value === '多选题') {
                /*提示文字*/
                $('.text-muted').css('display', '').text('点击按钮增加新的选项，并选中对应选项做为答案');
                /*混杂模式*/
                $('.checkbox-inline').css('display', 'none');
                $('.answer_choice').text("选项设置");
                let $container = $(".panel-group");
                $(".col-sm-5", $container).eq(1).prevAll().css("display", "none");
                $(".col-sm-5", $container).eq(1).css("display", "");
                $(".col-sm-5", $container).eq(1).nextAll().css("display", "none");
                $(".col-sm-5", $container).eq(0).css("display", "none");
                $('.multiple_choice').css('display', '');
                /*显示编辑框*/
                $('#accordion').css('display', '');
                /*隐藏判断题*/
                $('.judgment').css('display', 'none');
                /*隐藏文件上传*/
                $('.attachment_title').css('display', 'none');
                testItemList(1);
            }
            if (this.value === '填空题') {
                /*提示文字*/
                $('.text-muted').css('display', 'none');
                /*混杂模式*/
                $('.checkbox-inline').css('display', '');
                $('#accordion').css('display', '');
                /*把选择框隐藏*/
                $('.judgment').css('display', 'none');
                /*隐藏添加按钮*/
                $('.multiple_choice').css('display', '');
                /*填空题*/
                let $container = $(".panel-group");
                $(".col-sm-5", $container).eq(3).prevAll().css("display", "none");
                $(".col-sm-5", $container).eq(3).css("display", "");
                /*隐藏文件上传*/
                $('.attachment_title').css('display', 'none');
                testItemList(3);
            }
            if (this.value === '问答题') {
                /*隐藏单选多选输入框*/
                let $container = $(".panel-group");
                $(".col-sm-5", $container).eq(2).prevAll().css("display", "none");
                $(".col-sm-5", $container).eq(2).css("display", "");
                $(".col-sm-5", $container).eq(2).nextAll().css("display", "none");
                /*隐藏判断题*/
                $('.judgment').css('display', 'none');
                /*填空题*/
                /*隐藏添加按钮*/
                $('.multiple_choice').css('display', 'none');
                /*隐藏文件上传*/
                $('.attachment_title').css('display', 'none');
            }
            if (this.value === '附件题') {
                /*隐藏按钮*/
                $('.multiple_choice').css('display', 'none');
                /*隐藏*/
                let $container = $(".panel-group");
                $(".col-sm-5", $container).eq(0).css("display", "none");
                $(".col-sm-5", $container).eq(0).nextAll().css("display", "none");
                /*显示文件上传*/
                $('.attachment_title').css('display', '');
            }
        })
    })
</script>
<!-- bootstrap table 操作 -->
<script>
    $(function () {
        <!-- CodeMirror 组件显示 试题中的代码 -->
        let editor = CodeMirror.fromTextArea(document.getElementById("code"), {
            lineWrapping: true,	//代码折叠
            lineNumbers: true,//显示行号
            matchBrackets: true,//括号匹配
            styleActiveLine: true,
            readOnly: true, //只读
            autofocus: true
        });
        editor.setSize('379px', '230px');

        setTimeout(function () {
            editor.refresh();
        }, 1500);


        //试题管理
        $('#my_test_item_table').bootstrapTable({
            url: '../../static/js/demo/exam/test_question_management.json',       //请求后台的URL（*）
            // method: 'get',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: queryParams,           //传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            onLoadSuccess: updateSwitchery,  //页面加载成功执行方法，更新开关按钮
            onPageChange: updateSwitchery,   //页面发送改变执行的方法， 更新开关按钮
            columns:
                [{
                    checkbox: true
                }, {
                    field: 'question_bank',
                    title: '题库',
                    align: 'center',
                }, {
                    field: 'type',
                    title: '类型',
                    align: 'center',
                }, {
                    field: 'status',
                    title: '状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value === "正常") {
                            return '<input type="checkbox" name="status" class="js-switch form-control" value="' + row.id + '" checked/>';
                        }
                        return '<input type="checkbox" name="status" class="js-switch form-control" value="' + row.id + '"/>';
                    },
                }, {
                    field: 'difficulty',
                    align: 'center',
                    title: '难度',
                }, {
                    field: 'question_stem',
                    align: 'center',
                    title: '题干',
                }, {
                    field: 'last_modified',
                    align: 'center',
                    title: '最后修改',
                    formatter: function (value, row, index) {
                        return "<div class='text-center'><p style='color:#000;margin-bottom: 0'>" + row.founder + "</p><p class='text-muted'>" + row.change_modified + "</p></div>";
                    }
                }, {
                    field: 'operate',
                    align: 'center',
                    title: '操作',
                    width: '200px',
                    formatter: function (value, row, index) {
                        return [
                            '<button type="button" class="btn btn-sm  btn-white review_test_item" data-toggle="modal" ><i class="fa fa-eye"/> 预览</button>',
                            '<button class="btn btn-white btn-sm modification" type="button" title="修改"> <i class="fa fa-wrench"/> 修改</button>',
                            '<button type="button" class="btn btn-sm  btn-white" title="删除试题"><i class="fa fa-close"/> 删除</button>'
                        ].join("");//删除
                    },
                    events: {
                        'click button[title=删除试题]': function (e, value, row, index) {
                            swal({
                                title: "您确定要删除这条信息吗",
                                text: "删除后将无法恢复，请谨慎操作！",
                                type: "warning",
                                showCancelButton: true,
                                cancelButtonText: '取消',
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "删除",
                                closeOnConfirm: false
                            }, function () {
                                //TODO 发送ajax请求
                                swal("删除成功！", "您已经永久删除了这条信息。", "success");
                            });
                        },
                        'click button[title=修改]': function (e, value, row, index) {
                            /*隐藏创建试题*/
                            $('#create_question').css("display", "none");
                            /*把创建试题的按钮变成白色*/
                            $('.test_base_management').attr("class", "btn btn-sm  btn-white test_base_management");
                            /*显示修改内容*/
                            $('#modify').removeAttr("style");
                            //       let removeAttr = $('.question_type').find('option').removeAttr("selected");
                            /*试题类型*/
                            $('.question_type').find('option').eq(0).text(row.type);
                            /*试题难度*/
                            $('.modify_difficulty').find('option').eq(0).text(row.difficulty);
                            /*所属题库  modify_test_bank*/
                            let jQuery = $('.modify_test_bank').find('option').eq(0).text(row.question_bank);
                            /*试题来源*/
                            $('.modify_input').val(row.source_test);
                            /*试题标签*/
                            /*先删除所有的span再追加*/
                            $('.modify_tags span').remove();
                            for (let i = 0; i < row.lebel.length; i++) {
                                let val = row.lebel[i];
                                $('#modify_form-field-tags').before("<span class='tag'>" + val + "<button class='close' type='button'>×</button></span>"); //添加标签
                            }
                            /*题库状态*/
                            if (row.status === '正常') {
                                $('#modify_radio1').prop("checked", true);
                                $('#modify_radio2').prop("checked", false);
                            } else {
                                $('#modify_radio1').prop("checked", false);
                                $('#modify_radio2').prop("checked", true);
                            }
                            /*判断题型*/
                            if (row.type === '单选题') {
                                /*新建一个数组存放追加后的所有元素*/
                                let radiolList = [];
                                $('.answer_choice').text("选项设置");
                                /*显示添加按钮*/
                                $('.multiple_choice').css('display', '');
                                /*提示文字*/
                                $('.text-muted').css('display', '');
                                /*隐藏问答题答案设置*/
                                let $container = $("#modify_accordion");
                                $(".col-sm-5", $container).eq(1).css("display", "none");
                                /*把选择框隐藏*/
                                $('.judgment').css('display', 'none');
                                /*试题类型  selected*/
                                /*判断选项*/
                                let idx = 10;
                                let os = row.option_settings;
                                /*新建一个数组*/
                                var array = [];
                                var j = 0;
                                /*防止重复添加数据*/
                                $("#modify_accordion .col-sm-5").eq(2).nextAll().remove();
                                for (key in os) {
                                    let element = '<div class="col-sm-5 modifyed0">\n' +
                                        '<!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->\n' +
                                        '<div class="panel panel-default">\n' +
                                        '<!-- 一组章节 -->\n' +
                                        '<div class="panel-heading" role="tab">\n' +
                                        '<h4 class="panel-title">\n' +
                                        '<!-- 在右上角添加关闭小图标 -->\n' +
                                        '<button type="button" class="close"\n' +
                                        'data-dismiss="close"\n' +
                                        'style="margin-top: 3px;">\n' +
                                        '<span class="scaleClose"\n' +
                                        'style="size: 30px">&times;</span>\n' +
                                        '</button>\n' +
                                        '<!-- 输入项: 章节名称 -->\n' +
                                        '<div class="radio radio-success"\n' +
                                        'style="width:85%">\n' +
                                        '<input type="radio"\n' +
                                        'class="radio_select"\n' +
                                        'id="' + os[key] + '"\n' +  /*修改id*/
                                        'name="chapter_options"\n' +
                                        '>\n' +
                                        '<label class="options"\n' +
                                        'for="' + os[key] + '">' + key + '</label>\n' + /*修改for*/
                                        '</div>\n' +
                                        '</h4>\n' +
                                        '</div>\n' +
                                        '<!-- 内容区 -->\n' +
                                        '<div class="panel-body">\n' +
                                        '<textarea id="' + idx++ + '"\n' +
                                        'autofocus>' + os[key] + '</textarea>\n' +
                                        '</div>\n' +
                                        '</div>\n' +
                                        '</div>';
                                    $('#modify_accordion').append(element);
                                    /*把元素添加到数组当中*/
                                    radiolList.push($(".modifyed").eq(j));
                                    array[j] = os[key];
                                    ++j;
                                }
                                /*迭代数组跟正确答案进行对比*/
                                for (subscript in array) {
                                    if (row.test_answer === array[subscript]) {
                                        /*数值前添加+号  number加号和数值加号需要用空格隔开 即实现加法运算*/
                                        ix = +3 + +subscript;
                                        $("#modify_accordion .col-sm-5").eq(ix).find('.radio input').prop("checked", true);
                                    }
                                }
                                $("textarea").each(function (index, element) {
                                    new Simditor({
                                        textarea: $(element),
                                        upload: true
                                    })
                                });
                                /*清除样式*/
                                $(".simditor-toolbar").removeAttr("style"); //ie,ff均支持
                                answerOptions(0, radiolList);
                            }
                            if (row.type === '多选题') {
                                /*新建一个数组*/
                                var choiceArray = [];
                                $('.answer_choice').text("选项设置");
                                /*显示添加按钮*/
                                $('.multiple_choice').css('display', '');
                                /*提示文字*/
                                $('.text-muted').css('display', '');
                                /*隐藏问答题答案设置*/
                                let $container = $("#modify_accordion");
                                $(".col-sm-5", $container).eq(1).css("display", "none");
                                /*把选择框隐藏*/
                                $('.judgment').css('display', 'none');
                                /*新建一个数组把value存入数组当中*/
                                let array = [];
                                let j = 0;
                                let os = row.option_settings;
                                $("#modify_accordion .col-sm-5").eq(2).nextAll().remove();
                                for (key in os) {
                                    $('#modify_accordion').append('<div class="col-sm-5 modifyed1">\n' +
                                        '<!-- 在点击增加章节时，来clone此元素，并追加到 父元素中 -->\n' +
                                        '<div class="panel panel-default">\n' +
                                        '<!-- 一组章节 -->\n' +
                                        '<div class="panel-heading" role="tab">\n' +
                                        '<h4 class="panel-title">\n' +
                                        '<!-- 在右上角添加关闭小图标 -->\n' +
                                        '<button type="button" class="close"\n' +
                                        'data-dismiss="close"\n' +
                                        'style="margin-top: 3px;">\n' +
                                        '<span class="scaleClose"\n' +
                                        'style="size: 30px">&times;</span>\n' +
                                        '</button>\n' +
                                        '<!-- 输入项: 章节名称 -->\n' +
                                        '<div class="checkbox"\n' +
                                        'style="width: 85%">\n' +
                                        '<input type="checkbox"\n' +
                                        'class="choice"\n' +
                                        ' id="' + os[key] + '"\n' +  /*修改id*/
                                        'value="option1">\n' +
                                        '<label class="selects"\n' +
                                        'for="' + os[key] + '">\n' +
                                        '' + key + ' </label>\n' +
                                        '</div>\n' +
                                        '</h4>\n' +
                                        '</div>\n' +
                                        '<div class="panel-body">\n' +
                                        '<textarea id="modify_editor2"\n' +
                                        'autofocus>' + os[key] + '</textarea>\n' +
                                        '</div>\n' +
                                        '</div>\n' +
                                        '</div>');
                                    choiceArray.push($(".modifyed").eq(j));
                                    array[j] = os[key];
                                    ++j;
                                }
                                $("textarea").each(function (index, element) {
                                    new Simditor({
                                        textarea: $(element),
                                        upload: true
                                    })
                                });
                                /*清除样式*/
                                $(".simditor-toolbar").removeAttr("style"); //ie,ff均支持
                                /*把答案转换成数组*/
                                ta = row.test_answer.split(",");
                                for (subscript in array) {
                                    /*答案数组*/
                                    for (sb in ta) {
                                        if (ta[sb] === array[subscript]) {
                                            /*数值前添加+号  number加号和数值加号需要用空格隔开 即实现加法运算*/
                                            ix = +3 + +subscript;
                                            let eq = $("#modify_accordion .col-sm-5").eq(ix).find('.checkbox input').prop("checked", true);
                                        }
                                    }
                                }
                                answerOptions(1, choiceArray);
                            }
                            if (row.type === '判断题') {
                                /*隐藏问答题答案设置*/
                                let container = $("#modify_accordion");
                                $(".col-sm-5", container).eq(1).css("display", "none");
                                /*如果是判断题 隐藏输入框*/
                                $("#modify_accordion .col-sm-5").eq(2).nextAll().remove();
                                $('.answer_choice').text("答案设置");
                                /*隐藏添加按钮*/
                                $('.multiple_choice').css('display', 'none');
                                /*隐藏单选框*/
                                let $container = $(".panel-group");
                                $(".col-sm-5", $container).eq(0).siblings().css("display", "none");
                                $(".col-sm-5", $container).eq(0).css("display", "none");
                                /*把选择框显现*/
                                $('.judgment').css('display', '');
                                /*隐藏文件上传*/
                                $('.modify_attachment_title').css('display', 'none');
                                if (row.test_answer === '正确') {
                                    $('#modify_true').prop("checked", true);
                                    $('#modify_false').prop("checked", false);
                                } else {
                                    $('#modify_true').prop("checked", false);
                                    $('#modify_false').prop("checked", true);
                                }
                            }
                            if (row.type === '填空题') {
                                /*新建数组*/
                                let fvp = [];
                                let f = 0;
                                /*隐藏问答题答案设置*/
                                let container = $("#modify_accordion");
                                $(".col-sm-5", container).eq(1).css("display", "none");
                                $('.answer_choice').text("答案设置");
                                /*提示文字*/
                                $('.text-muted').css('display', 'none');
                                /*混杂模式*/
                                $('.checkbox-inline').css('display', '');
                                $('#accordion').css('display', '');
                                /*把选择框隐藏*/
                                $('.judgment').css('display', 'none');
                                /*显示添加按钮*/
                                $('.multiple_choice').css('display', '');
                                /*填空题*/
                                let $container = $(".panel-group");
                                let testAnswer = row.test_answer;
                                $("#modify_accordion .col-sm-5").eq(2).nextAll().remove();
                                for (key in testAnswer) {
                                    $('#modify_accordion').append('<div class="col-sm-5 modifyed3">\n' +
                                        '<div class="alert alert-dismissable fade in"\n' +
                                        'style="background-color: #d2cece ">\n' +
                                        '<button class="close" type="button"\n' +
                                        'data-dismiss="alert" aria-label="Close">\n' +
                                        '<span aria-hidden="true"\n' +
                                        'style="color: white">x</span>\n' +
                                        '</button>\n' +
                                        '<h3 style="color: white">' + key + '</h3>\n' +
                                        '<input type="text" class="form-control"\n' +
                                        'placeholder="请填写答案" value="' + testAnswer[key] + '">\n' +
                                        '</div>\n' +
                                        '</div> ');
                                    fvp.push($(".modifyed").eq(f));
                                    ++f;
                                }
                                /*隐藏文件上传*/
                                $('.modify_attachment_title').css('display', 'none');
                                answerOptions(3, fvp);
                            }
                            if (row.type === '问答题') {
                                $('.answer_choice').text("答案设置");
                                /*提示文字*/
                                $('.text-muted').css('display', 'none');
                                /*把选择框隐藏*/
                                $('.judgment').css('display', 'none');
                                $("#modify_accordion .col-sm-5").eq(2).nextAll().remove();
                                /*混杂模式*/
                                $('.checkbox-inline').css('display', 'none');
                                $('#accordion').css('display', 'none');
                                /*隐藏添加按钮*/
                                $('.multiple_choice').css('display', 'none');
                                let $container = $("#modify_accordion");
                                $(".col-sm-5", $container).eq(1).css("display", "");
                                /*隐藏文件上传*/
                                $('.modify_attachment_title').css('display', 'none');
                                /*回显数据*/
                                /*先清除再写内容防止追加*/
                                let editor1 = $('.modify_qa_editor .simditor .simditor-body p');
                                editor1.empty();
                                editor1.text(row.test_answer);
                            }
                            if (row.type === '附件题') {
                                /*隐藏问答题答案设置*/
                                let $container = $("#modify_accordion");
                                $(".col-sm-5", $container).eq(1).css("display", "none");
                                /*提示文字*/
                                $('.text-muted').css('display', 'none');
                                /*隐藏添加按钮*/
                                $('.multiple_choice').css('display', 'none');
                                $('.modify_attachment_title').css('display', '');
                                $("#modify_accordion .col-sm-5").eq(2).nextAll().remove();
                                /*把选择框显现*/
                                $('.judgment').css('display', 'none');
                            }
                            /*试题题干*/
                            $('.topic .simditor .simditor-body p').text(row.question_stem);
                            /*答案解析*/
                            $('.answer_parsing .simditor .simditor-body p').text(row.answer_analysis);
                        },
                        'click .review_test_item': function (e, value, row, index) {
                            /*模态框*/
                            $('#review_test_item').modal();
                            //判断题型对预览做改变
                            var table = $('#preview_table');
                            if (row.type === '单选题' || row.type === '多选题' || row.type === '判断题' || row.type === '附件题') {
                                /*迭代*/
                                let os = row.option_settings;
                                if (os != null) {
                                    $('.settings').removeAttr("style");
                                    /*防止重复添加数据*/
                                    $(".option_settings tr").remove();
                                    for (key in os) {
                                        $('.option_settings .tbody').append('<tr>\n' +
                                            '<td style="width: 50px;text-align: center;background: #f5f5f5">' + key + '</td>\n' +
                                            '<td style="word-break: break-all">' + os[key] + '</td>\n' +
                                            '</tr>');
                                    }
                                }
                                /*判断题和附件题会出选选项设置*/
                                if (row.type === '判断题' || row.type === '附件题') {
                                    $('.settings').css("display", "none");
                                }
                                /*隐藏编辑框*/
                                $('.code').css("display", "none");
                                /*显示*/
                                $('.test_answer').removeAttr("style");
                                $('.test_answer').text(row.test_answer);
                            } else {
                                $('.settings').css("display", "none");
                                /*显示编辑框*/
                                $('.code').css("display", "");
                                /*显示*/
                                $('.test_answer').css("display", "none");
                            }
                            if (row.type === '填空题') {
                                /*隐藏QA*/
                                $('.QA').attr("class", "QA hidden");
                                $('.FB_QA').removeAttr("style");
                                let qa = row.test_answer;
                                if (typeof qa == 'object') {
                                    $(".QA_table  tr").remove();
                                    for (key in qa) {
                                        $('.QA_table .tbody').append('<tr>\n' +
                                            '<td style="width: 50px;text-align: center;background: #f5f5f5">' + key + '</td>\n' +
                                            '<td style="word-break: break-all">' + qa[key] + '</td>\n' +
                                            '</tr>');
                                    }
                                }
                            } else {
                                $('.QA').attr("class", "QA");
                                $('.FB_QA').css("display", "none");
                            }
                            table.find('tr:eq(0) td:eq(0)').text(row.type);
                            table.find('tr:eq(1) td:eq(0)').text(row.difficulty);
                            table.find('tr:eq(2) td:eq(0)').text(row.question_bank);
                            table.find('tr:eq(3) td:eq(0) span').text(row.lebel);
                            table.find('tr:eq(4) td:eq(0)').text(row.status);
                            table.find('tr:eq(5) td:eq(0) p').text(row.question_stem);
                            let qa = row.test_answer;
                            if (typeof qa == 'string') {
                                editor.setValue(row.test_answer);
                            }
                            $('.Parsing').text(row.answer_analysis);
                        }
                    }
                }]
        });

        /*共享题库*/
        $('#share_test_item_table').bootstrapTable({
            url: '../../static/js/demo/exam/test_question_management.json', //请求后台的URL（*）
            // method: 'get',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: queryParams,           //传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            onLoadSuccess: updateSwitchery,  //页面加载成功执行方法
            onPageChange: updateSwitchery,   //页面发送改变执行的方法
            columns:
                [{
                    checkbox: true
                }, {
                    field: 'question_bank',
                    title: '题库',
                    align: 'center',
                }, {
                    field: 'type',
                    title: '类型',
                    align: 'center',
                }, {
                    field: 'status',
                    title: '状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value === "正常") {
                            return '<input type="checkbox" name="status" class="js-switch form-control" value="' + row.id + '" checked disabled/>';
                        }
                        return '<input type="checkbox" name="status" class="js-switch form-control" value="' + row.id + '"disabled/>';
                    },
                }, {
                    field: 'difficulty',
                    align: 'center',
                    title: '难度',
                }, {
                    field: 'question_stem',
                    align: 'center',
                    title: '题干',
                }, {
                    field: 'last_modified',
                    align: 'center',
                    title: '最后修改',
                    formatter: function (value, row, index) {
                        return "<div class='text-center'><p style='color:#000;margin-bottom: 0'>" + row.founder + "</p><p class='text-muted'>" + row.change_modified + "</p></div>";
                    }
                }, {
                    field: 'operate',
                    align: 'center',
                    title: '操作',
                    width: '200px',
                    formatter: function (value, row, index) {
                        return [
                            /* '<button type="button" class="btn btn-sm  btn-white" data-toggle="modal" data-target="#review_test_item" title="共享预览" ><i class="fa fa-eye"/> 预览</button>',*/
                            '<button type="button" class="btn btn-sm  btn-white " data-toggle="modal" title="共享预览" ><i class="fa fa-eye"/> 共享预览</button>',
                        ].join("");//删除
                    },
                    events: {
                        'click button[title=共享预览]': function (e, value, row, index) {
                            /*模态框*/
                            $('#review_test_item').modal();
                            //判断题型对预览做改变
                            var table = $('#preview_table');
                            if (row.type === '单选题' || row.type === '多选题' || row.type === '判断题' || row.type === '附件题') {
                                /*迭代*/
                                let os = row.option_settings;
                                if (os != null) {
                                    $('.settings').removeAttr("style");
                                    /*防止重复添加数据*/
                                    $(".option_settings  tr").remove();
                                    for (key in os) {
                                        $('.option_settings .tbody').append('<tr>\n' +
                                            '<td style="width: 50px;text-align: center;background: #f5f5f5">' + key + '</td>\n' +
                                            '<td style="word-break: break-all">' + os[key] + '</td>\n' +
                                            '</tr>');
                                    }
                                }
                                /*判断题和附件题会出选选项设置*/
                                if (row.type === '判断题' || row.type === '附件题') {
                                    $('.settings').css("display", "none");
                                }
                                /*隐藏编辑框*/
                                $('.code').css("display", "none");
                                /*显示*/
                                $('.test_answer').removeAttr("style");
                                $('.test_answer').text(row.test_answer);
                            } else {
                                $('.settings').css("display", "none");
                                /*显示编辑框*/
                                $('.code').css("display", "");
                                /*显示*/
                                $('.test_answer').css("display", "none");
                            }
                            if (row.type === '填空题') {
                                /*隐藏QA*/
                                $('.QA').attr("class", "QA hidden");
                                $('.FB_QA').removeAttr("style");
                                let qa = row.test_answer;
                                if (typeof qa == 'object') {
                                    $(".QA_table  tr").remove();
                                    for (key in qa) {
                                        $('.QA_table .tbody').append('<tr>\n' +
                                            '<td style="width: 50px;text-align: center;background: #f5f5f5">' + key + '</td>\n' +
                                            '<td style="word-break: break-all">' + qa[key] + '</td>\n' +
                                            '</tr>');
                                    }
                                }
                            } else {
                                $('.QA').attr("class", "QA");
                                $('.FB_QA').css("display", "none");
                            }
                            table.find('tr:eq(0) td:eq(0)').text(row.type);
                            table.find('tr:eq(1) td:eq(0)').text(row.difficulty);
                            table.find('tr:eq(2) td:eq(0)').text(row.question_bank);
                            table.find('tr:eq(3) td:eq(0) span').text(row.lebel);
                            table.find('tr:eq(4) td:eq(0)').text(row.status);
                            table.find('tr:eq(5) td:eq(0) p').text(row.question_stem);
                            let qa = row.test_answer;
                            if (typeof qa == 'string') {
                                editor.setValue(row.test_answer);
                            }
                            $('.Parsing').text(row.answer_analysis);
                        }
                    }
                }]
        });

        //查询参数 [可选】
        function queryParams(params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                limit: params.limit,   //页面大小
                offset: params.offset,  //页码
                departmentname: $("#txt_search_departmentname").val(),
                statu: $("#txt_search_statu").val()
            };
            return temp;
        };
    });
    /*根据json数据给滑动按钮设置状态*/
    //当bootstraptable的页面分页时，要及时更新 switchery组件
    function updateSwitchery(value, row, index) {
        $(".js-switch").each(function (index, element) {
            //判断 element是否已经是 switchery 组件了
            if ($(element).attr("data-switchery") !== 'true') {
                //重新创建switchery对象
                new Switchery(element, {size: 'normal'});
                //绑定事件, 以 element 为参数，以便里面的代码通过 event.data 来获取此element对象，并进一步拿到ic的值
                $(element).on('change', element, function (event) {
                    //todo 发送请求到服务端，更新状态
                    alert("修改id为" + $(event.data).val() + "的试题：" + element.checked);
                });
            } else {
            }
        });
    }
</script>
<!--富文本框-->
<script>
    /*查找所有的textarea遍历完成实例化*/
    $("textarea").each(function (index, element) {
        new Simditor({
            textarea: $(element),
            upload: true
        })
    });
    /*清除样式*/
    $(".simditor-toolbar").removeAttr("style"); //ie,ff均支持
</script>
<!--输入标签-->
<script>
    labelName('.tags_enter', '.tags', '#form-field-tags');
    labelName('.modify_tags_enter', '.modify_tags', '#modify_form-field-tags');

    /*
    * inputName:输入标签input的class
    * divName:输入标签div的class
    * inputId:显示标签input的id
    * */
    function labelName(inputName, divName, inputId) {
        $(inputName).blur(function () { //焦点失去触发
            var txtvalue = $(this).val().trim();
            if (txtvalue !== '') {
                addTag($(this), inputId);
                /*div 标签*/
                $(this).parents(divName).css({"border-color": "#d5d5d5"})
            }
        }).keydown(function (event) {
            var key_code = event.keyCode;
            var txtvalue = $(this).val();
            if (key_code === 13 && txtvalue !== '') { //enter
                addTag($(this), inputId);
            }
            if (key_code === 32 && txtvalue.trim() !== '') { //space
                /*去除space空格*/
                var space_value = $(this).val();
                addTag($(this), inputId); //Object
            }
        });

        /*标签删除按钮 */
        $(document).on("click", ".close", function () {
            $(this).parent(".tag").remove();
        });
        /*悬浮颜色  div标签 .tags*/
        $(divName).click(function () {
            $(this).css({"border-color": "#6ac7b5"})
        }).blur(function () {
            $(this).css({"border-color": "#d5d5d5"})
        });

    }

    function addTag(obj, inputId) {
        /*去除出输入框内的空格*/
        var tag = obj.val().trim();
        if (tag !== '') {
            var i = 0;
            /*span标签 tag*/
            $(".tag").each(function () {
                if ($(this).text() === tag + "×") {
                    $(this).addClass("tag-warning");
                    setTimeout("removeWarning()", 400);
                    i++;
                }
            });
            obj.val('');
            if (i > 0) { //说明有重复
                return false;
            } else {
                $(inputId).before("<span class='tag'>" + tag + "<button class='close' type='button'>×</button></span>"); //添加标签
            }
            removeWarning('.tag-warning');
        }
    }

    function removeWarning(labelName) {
        $(labelName).removeClass("tag-warning");
    }


</script>
</html>